package com.alan.base;

import android.app.Application;
import android.os.Handler;
import android.os.Looper;

public class App {

    private Application application;
    private final Handler mainHandler;
    private static App app;

    private App() {
        mainHandler = new Handler(Looper.getMainLooper());
    }

    public static synchronized App getInstance() {
        if (null == app) {
            synchronized (App.class) {
                if (null == app) {
                    app = new App();
                }
            }
        }
        return app;
    }

    public void init(Application application) {
        this.application = application;
    }

    public Application getApplication() {
        return application;
    }

    public Handler getMainHandler() {
        return mainHandler;
    }
}
